package com.gaogao.java;

import java.io.File;

public class FileTest {
    public static void main(String args[]){
          File file=new File("D:/baidu");
          toFile(file,0);
    }
    public static void toFile(File file,int count){
        for (int i=0;i<count;i++){
            System.out.print("-");
        }
        System.out.println(file.getName());
        if(file.isDirectory()){
            File[] files=file.listFiles();
            for (File temp:files){
                toFile(temp,count+1);
            }

        }

    }
}
